<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

//$str = '{\"id\":\"41b7bfbb249bcd7e5466d4d404e3c115u5\",\"url\":\"https:\\/\\/m1-1253159997.image.myqcloud.com\\/imageDir\\/41b7bfbb249bcd7e5466d4d404e3c115u5.jpg\"';
//echo csImgForJson($str);

/**
 * 图片路径替换
 * @param      $content
 * @return mixed.
 */
function csImgForJson($content)
{
    $origin = '1adfdafdfaf';

    //$replace = '//' . resource_domain() . '/dp/api/images';
    $replace = '\\/\\/' .'ddddddd'. '/dp/api/files';
    $content = str_ireplace([
        'cs:image:\\/\\/',
        'cs:image:\/',
        'http:\\/\\/' . $origin,
        'https:\\/\\/' . $origin,
        'http:\\/\\/m1-1253159997.file.myqcloud.com',
        'https:\\/\\/m1-1253159997.file.myqcloud.com',
        'http:\\/\\/m1-1253159997.image.myqcloud.com',
        'https:\\/\\/m1-1253159997.image.myqcloud.com',
    ], $replace, $content);

    return $content;
}

//try {
//    call_user_func('tests',1);
//    echo 333;
//}catch (Exception $exception){
//    var_dump($exception->getMessage());
//}exit;
//function tests(){
//    $data = test2();
//    return $data;
//}
//
//
//function test2(){
//    throw (new ErrorException('errorrrrr'));
//    return 1;
//}
//define('LARAVEL_START', microtime(true));
//$str = 'ABC ABC ABCD ABC ABCD A A C D B ABCD BCD  B B B D C ABC ABC ABC A B B C C B D B ABC AD ABCD B A A A A C B C D ABC  ABCD A A A B A A B A';
//echo '<pre>';
//var_dump(explode(' ',str_replace("  ",' ',$str)));exit;

/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/

if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
    require __DIR__.'/../storage/framework/maintenance.php';
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/

require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = tap($kernel->handle(
    $request = Request::capture()
))->send();

$kernel->terminate($request, $response);
